package com.api.shopapi.entity;


import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;


@Setter
@Getter
@Data
@ToString
public class MyResult {
    //0:正常结束，1：正常未完成结束，2：异常报错
    private int Error;
    private String Message;
    private Object Data;


    public static MyResult Success(Object data) {
        MyResult result = new MyResult();
        result.setError(0);
        result.setData(data);
        return result;
    }

    public static MyResult Failed(String message) {
        MyResult result = new MyResult();
        result.setError(1);
        result.setMessage(message);
        return result;
    }

    public static MyResult Anomalous(String message) {
        MyResult result = new MyResult();
        result.setError(2);
        result.setMessage(message);
        return result;
    }


}